I got this following error while running the python web application. "AttributeError: Module 'whois' has no attribute 'whois'"
CODE:
def fetch_whois_info(request): domain_info='' if request.method == 'POST': domain_name = request.POST.get('domain_name') domain_info = get_whois_info(domain_name) return render(request, 'app/fetch_whois_info.html', {'domain_info': domain_info}) def get_whois_info(domain_name): domain_info = whois.whois(domain_name) expiration_date = domain_info.expiration_date last_updated = domain_info.last_updated registrar = domain_info.registrar creation_date = domain_info.creation_date # Convert expiration_date and creation_date to datetime if they are lists if isinstance(expiration_date, list): expiration_date = expiration_date[0] if isinstance(creation_date, list): creation_date = creation_date[0] return { 'expiration_date': expiration_date , 'last_updated': last_updated, 'registrar': registrar, 'name': domain_name, 'creation_date': creation_date }
SOLUTION:
pip install python-whois
VIDEO GUIDE:
Post your comments / questions
Recent Article
- The request was aborted: Could not create SSL/TLS secure channel -Error in Asp.net
- FieldError: Cannot resolve keyword 'id' into field in Django project
- How to hide the ID field from the Django admin?
- It is impossible to add a non nullable field without specifying a default. Django error
- ImportError: cannot import name 'url' from 'django.conf.urls' - Django Error
- How to Enable Virtualization in BIOS Security Settings in Intel Processors For Android Studio?
- Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it.
- AttributeError: 'NoneType' object has no attribute 'get_text' - Python
Related Article